package com.culture.bootdemo.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 一个service多个实现类 枚举
 */
@Getter
@AllArgsConstructor
public enum ExcelEnum {
    //
    first("1", "上传文件测试一","demo1ExcelHandler"),
    second("2", "上传文件测试二","demo2ExcelHandler");

    String status;
    String desc;
    String handlerNameDesc;


    public static ExcelEnum getInstance(String status) {
        if (StringUtils.isBlank(status)) {
            return null;
        }
        for (ExcelEnum approvalStatus : ExcelEnum.values()) {
            if (approvalStatus.getStatus().equals(status)) {
                return approvalStatus;
            }
        }
        return null;
    }

    public static String getNameDesc(String status) {
        if (StringUtils.isBlank(status)) {
            return "";
        }
        for (ExcelEnum approvalStatus : ExcelEnum.values()) {
            if (approvalStatus.getStatus().equals(status)) {
                return approvalStatus.getHandlerNameDesc();
            }
        }
        return "";
    }
}
